package com.service.Impl;

import com.dao.UserQuestionDao;
import com.mypg.Question;
import com.mypg.UserQuestion;
import com.mypg.UserRank;
import com.mypg.WrongChapter;
import com.service.UserQuestionService;

import java.util.List;

public class UserQuestionServiceImpl implements UserQuestionService {

    private UserQuestionDao userQuestionDao;

    public UserQuestionServiceImpl(){}
    public UserQuestionServiceImpl(UserQuestionDao userQuestionDao) {
        this.userQuestionDao = userQuestionDao;
    }

    @Override
    public List<UserQuestion> selectAllUserQuestion() {
        return userQuestionDao.selectAllUserQuestion();
    }

    @Override
    public int selectUserQuestion_count() {
        return userQuestionDao.selectUserQuestion_count();
    }

    @Override
    public UserQuestion selectUserQuestionByUserQuestion_id(int user_id, int question_id) {
        return userQuestionDao.selectUserQuestionByUserQuestion_id(user_id,question_id);
    }

    @Override
    public List<UserQuestion> selectUserQuestion_for_user_question_table_jsp(String user_nickname, int question_id, int start_row, int page_nums) {
        return userQuestionDao.selectUserQuestion_for_user_question_table_jsp(user_nickname,question_id,start_row,page_nums);
    }

    @Override
    public int selectUserQuestion_count_For_user_question_table_jsp(String user_nickname, int question_id) {
        return userQuestionDao.selectUserQuestion_count_For_user_question_table_jsp(user_nickname,question_id);
    }

    @Override
    public int selectCountByFlag_pass_and_user_id(int user_id, int flag_pass,String question_class,String question_chapter) {
        return userQuestionDao.selectCountByFlag_pass_and_user_id(user_id,flag_pass,question_class,question_chapter);
    }

    @Override
    public List<WrongChapter> selectWrongChapterByUser_id(int user_id, int flag_pass, String question_class) {
        return userQuestionDao.selectWrongChapterByUser_id(user_id,flag_pass,question_class);
    }

    @Override
    public List<Question> selectWrongQuestionByUser_id(int user_id, String question_class, String question_chapter, int flag_pass) {
        return userQuestionDao.selectWrongQuestionByUser_id(user_id,question_class,question_chapter,flag_pass);
    }

    @Override
    public List<UserRank> selectUserRank() {
        return userQuestionDao.selectUserRank();
    }

    @Override
    public void deleteUserQuestionByUserQuestion_id(int user_id, int question_id) {

        userQuestionDao.deleteUserQuestionByUserQuestion_id(user_id,question_id);
    }

    @Override
    public void insertUserQuestion(UserQuestion userQuestion) {
        userQuestionDao.insertUserQuestion(userQuestion);
    }

    @Override
    public void updateFlag_passByUser_id_and_question_id(int user_id, int question_id, int flag_pass) {
        userQuestionDao.updateFlag_passByUser_id_and_question_id(user_id,question_id,flag_pass);
    }

    @Override
    public void updateUser_nicknameByUser_id(int user_id, String user_nickname) {
        userQuestionDao.updateUser_nicknameByUser_id(user_id,user_nickname);
    }

    public UserQuestionDao getUserQuestionDao() {
        return userQuestionDao;
    }

    public void setUserQuestionDao(UserQuestionDao userQuestionDao) {
        this.userQuestionDao = userQuestionDao;
    }
}
